#ifndef __LOG_MANAGER_H__
#define __LOG_MANAGER_H__

#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string>
#include <windows.h>

#ifdef _WIN32
#ifndef MAX_PATH
#define MAX_PATH _MAX_PATH
#endif
#else
#define MAX_PATH 255
#endif

class LogManager
{
public:
    LogManager(void);
    ~LogManager(void);

    void SetLogFilePath(const std::string& szNewPath);
    const std::string GetLogFilePath();

    void SetLogFileMaxSize(const unsigned long& ulNewSize);
    const unsigned long GetLogFileMaxSize();

    void PutWithDateAndTime(char* text, ...);

private:
    CRITICAL_SECTION criticalSection;
    std::string szLogFilePath;
    unsigned long ulLogFileMaxSize;

    void CheckLogSize();
};

extern LogManager logManager;

#define LOGT(x) logManager.PutWithDateAndTime x

#endif //__LOG_MANAGER_H__